
<!-- 增加页面开始 -->


[#macro sitetenantAddView]
    <div  class="model-form">
        <el-page-header @back="goBack" content="增加租户管理">
        </el-page-header>
        <div class="model-content">
            <el-form ref="ruleForm" :rules="rules" :model="form" label-width="160px" >
                <el-row :gutter="10">
 <el-col :span="12">
     <el-form-item label="标识" size="mini" prop="key">
             <el-input v-model="form.key" name="key">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="名称" size="mini" prop="name">
             <el-input v-model="form.name" name="name">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="域名" size="mini" prop="domain">
             <el-input v-model="form.domain" name="domain">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="logo" size="mini" prop="logo">
             <el-input v-model="form.logo" name="logo">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="电话" size="mini" prop="phone">
             <el-input v-model="form.phone" name="phone">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="地址" size="mini" prop="address">
             <el-input v-model="form.address" name="address">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="theme" size="mini" prop="theme">
             <el-input v-model="form.theme" name="theme">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="租户介绍" size="mini" prop="note">
             <el-input v-model="form.note" name="note" type="textarea"></el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="客服签名" size="mini" prop="chatSign">
             <el-input v-model="form.chatSign" name="chatSign" type="textarea"></el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="类型" size="mini" prop="catalog">
             <el-input v-model="form.catalog" name="catalog">
             </el-input>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="开始日期" size="mini" prop="beginDate">
            <el-date-picker v-model="form.beginDate" type="date"   value-format="yyyy-MM-dd"  placeholder="选择日期">
            </el-date-picker>
     </el-form-item>
      
 </el-col>
 <el-col :span="12">
     <el-form-item label="到期日期" size="mini" prop="expireDate">
            <el-date-picker v-model="form.expireDate" type="date"   value-format="yyyy-MM-dd"  placeholder="选择日期">
            </el-date-picker>
     </el-form-item>
      
 </el-col>
                </el-row>
               <el-row>
                    <el-col :span="24"  style="text-align: right;padding-bottom: 20px;padding-top: 20px;">
                        <el-button @click="goBack">取消</el-button>
                        <el-button type="primary" @click="add">确定</el-button>
                    </el-col>
			    </el-row>
            </el-form>
        </div>
    </div>
[/#macro]

[#macro sitetenantAddConfig]
<script type="text/x-template" id="my-sitetenant-add">
	[@sitetenantAddView /]
</script>
<script type="text/javascript">
		//添加组件开始
		var sitetenantAddConfig = {};
		sitetenantAddConfig.template = "#my-sitetenant-add";
		sitetenantAddConfig.methods = config.basicMethod();
		sitetenantAddConfig.data = function () {
			return {
				form: {
					key: '',
					name: '',
					domain: '',
					logo: '',
					phone: '',
					address: '',
					theme: '',
					note: '',
					chatSign: '',
					catalog: '',
					beginDate: '',
					expireDate: ''				},
				rules: {
                        key: [
							{ required: true, message: '请输入标识', trigger: 'blur' }
						],
				}
			}
		};
		sitetenantAddConfig.mounted = function () {
		}
		sitetenantAddConfig.computed = {};


		sitetenantAddConfig.methods.add = function () {
			var self = this;
			this.$refs["ruleForm"].validate(function(valid){
				if (valid) {
					self.addData();
				} else {
					console.log('error submit!!');
					return false;
				}
			});
		}

		sitetenantAddConfig.methods.addData = function () {
			var self = this, data = this.form;
			if (this.deforeAddData) {
				this.deforeAddData();
			}
			this.postData("${siteurl}tenantRest/sitetenant/create.htm", data, function (res) {
				if (res.code == 0) {
					self.$message({
						message: '添加数据成功',
						type: 'success'
					});
					self.$router.go(-1);
				} else {
					self.$message.error(res.msg);
				}
			});
		}

        sitetenantAddConfig.destroyed = function () {
            console.log("destroyed add view ");
            
	    }
		var  sitetenantAddView = Vue.component('add-view', sitetenantAddConfig);


</script>
[/#macro]

<!-- 增加页面结束 -->